import Vue from 'vue'
import App from './App.vue'
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import router from './router.js'

import '@/styles/index.scss'


Vue.use(ElementUI)

//路由守卫
router.beforeEach((to, from, next) => {
  let token = localStorage.getItem("myToken");
  if (token) {
    next();
  } else {
    if (to.path === "/login") {
      next();
    } else {
      next({ path: "/login" });
    }
  }
});

Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
